package io.kiki.sba.registry.server.clientInterface.remoting.console.handler;

import io.kiki.sba.registry.api.Channel;
import io.kiki.sba.registry.common.model.GenericResponse;
import io.kiki.sba.registry.common.model.Response;
import io.kiki.sba.registry.common.model.sessionserver.StopPushRequest;
import io.kiki.sba.registry.server.clientInterface.providedata.FetchStopPushService;

import javax.annotation.Resource;


public class StopPushRequestHandler extends AbstractConsoleHandler<StopPushRequest> {

    @Resource
    private FetchStopPushService fetchStopPushService;

    @Override
    public Class interest() {
        return StopPushRequest.class;
    }

    @Override
    public Response doHandle(Channel channel, StopPushRequest request) {
        fetchStopPushService.setStopPushSwitch(System.currentTimeMillis(), request.isStop());
        return GenericResponse.buildSuccessResponse();
    }
}
